/*
** rt.h for rt in /home/le_e//project/project_b2/raytracer
** 
** Made by canh-kiet le
** Login   <le_e@epitech.net>
** 
** Started on  Thu Mar 29 11:02:24 2012 canh-kiet le
** Last update Mon Apr 30 21:32:58 2012 canh-kiet le
*/

#ifndef		RT_H_
#define		RT_H_

#include	"my.h"

#define		VALID_CHARS	"0123456789_-abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ"

#define		SET	0
#define		LGT	1
#define		OBJ	2
#define		TYP	3

enum
  {
    PLAN,
    SPHERE,
    CYLINDER,
    CONE,
  }	type;

typedef struct	s_check
{
  char		*(name_info[11]);
}		t_check;

typedef	struct	s_coord
{
  double	x;
  double	y;
  double	z;
}		t_coord;

typedef	struct	s_obj
{
  t_coord      	data;
  t_coord      	pos;
  t_coord      	rot;
  double       	n_refrac;
  double       	transm;
  double	absorb;
  double	reflec;
  double       	shiness;
  int		color;
  int		type;
  int		lim;
  int		end;
}		t_obj;

typedef	struct	s_lgt
{
  t_coord	pos;
  t_coord	rot;
  int		mode;
  int		color;
  double	intensity;
  int		end;
}		t_lgt;

typedef	struct	s_eye
{
  t_coord      	vect;
  t_coord      	pos;
  t_coord      	rot;
  int		fov;
}		t_eye;

typedef struct	s_point
{
  int		x;
  int		y;
}		t_point;

typedef struct	s_scene
{
  t_eye		eye;
  t_point      	size;
  t_obj		*obj;
  t_lgt		*lgt;
  int		line_err;
}		t_scene;


/*
**		init_cnf.c
*/
void		init_cnf(char *, t_scene *);

/*
**		check_filename.c
*/
void		check_filename(char *);

/*
**		init_structcheck.c
*/
void		init_check(t_check **check);

/*
**		fill_struct.c
*/
void		fill_eye(t_scene *sc, char **tab, int ind);
void		fill_lgt(t_lgt *lgt, char **tab, int ind, int err_line);
void		fill_obj(t_obj *obj, char **tab, int ind, int err_line);

/*
**		check_params.c
*/
void		disp_err(char *err_name, int line_err, char *err_desc);
int		cnt_params(char **params);
void		check_params(int ind, char **tab, int line_err);

/*
**		det_info.c
*/
int		det_type(char *line, t_check *check, t_scene *sc);

/*
**		fill_eye_fcts1.c
*/
void		eye_res(char **tab, t_scene *sc, int line_err);
void		eye_oeil(char **tab, t_scene *sc, int line_err);
void		eye_rot(char **tab, t_scene *sc, int line_err);
void		eye_fov(char **tab, t_scene *sc, int line_err);

/*
**		fill_lgt_fcts1.c
*/
void		lgt_pos(char **tab, t_lgt *lgt, int line_err);
void		lgt_rot(char **tab, t_lgt *lgt, int line_err);
void		lgt_mode(char **tab, t_lgt *lgt, int line_err);
void		lgt_color(char **tab, t_lgt *lgt, int line_err);
void		lgt_intens(char **tab, t_lgt *lgt, int line_err);

/*
**		fill_obj_fcts1.c
*/
void		obj_pos(char **tab, t_obj *obj, int line_err);
void		obj_rot(char **tab, t_obj *obj, int line_err);
void		obj_lim(char **tab, t_obj *obj, int line_err);
void		obj_data(char **tab, t_obj *obj, int line_err);
void		obj_n_ref(char **tab, t_obj *obj, int line_err);

/*
**		fill_obj_fcts2.c
*/
void		obj_shiness(char **tab, t_obj *obj, int line_err);
void		obj_color(char **tab, t_obj *obj, int line_err);
void		obj_transm(char **tab, t_obj *obj, int line_err);
void		obj_absorb(char **tab, t_obj *obj, int line_err);
void		obj_reflec(char **tab, t_obj *obj, int line_err);

/*
**		disp_err.c
*/
void		disp_err(char *err_name, int line_err, char *err_desc);

#endif
